//
//  HNMyHomeWorkMarignVC.m
//  BestLearning
//
//  Created by edz on 2017/12/27.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "HNMyHomeWorkMarignVC.h"
#import <UIButton+WebCache.h>
#import "ImgZoom.h"
#import "EMCDDeviceManager.h"

#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

@interface HNMyHomeWorkMarignVC ()<UITextFieldDelegate, UITextViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate,UIWebViewDelegate>
{
    __weak IBOutlet UIActivityIndicatorView *_Activity;
    __weak IBOutlet NSLayoutConstraint *_ScrollVIewHeight;
    __weak IBOutlet UIView *_HidenView;
    __weak IBOutlet NSLayoutConstraint *_NavigationViewHeight;
    __weak IBOutlet UIView *_XXXXView;
    __weak IBOutlet UILabel *_Name;

    
    /** *************   题目   ************ */
    __weak IBOutlet UILabel *_Title;
    __weak IBOutlet UILabel *_Content;
    IBOutletCollection(UIButton) NSArray *ImgViewArr;
    
    /** *************       回答   ************ */
    __weak IBOutlet UILabel *_CCCCCCCTitle;
    __weak IBOutlet UILabel *_CCCCCCCContent;
    __weak IBOutlet UILabel *_Answer_Title;
    __weak IBOutlet UILabel *_Answer_Content;
    IBOutletCollection(UIButton) NSArray *Answer_ImgViewArr;
    

    
    /** *************       批语   ************ */
    __weak IBOutlet UILabel *_Marign_Content;
    __weak IBOutlet UILabel *_Marign_Socre;
    IBOutletCollection(UIButton) NSArray *Marign_ImgViewArr;
    IBOutletCollection(UIView) NSArray *Marign_All1ViewArr;
    __weak IBOutlet UIView *_MarignWhiteView;
    
}
@property (nonatomic,strong)UIWebView *webView;

/** *************   题目   ************ */
@property (nonatomic, strong) NSMutableArray *Img_ImgUrl;
@property (nonatomic, strong) NSMutableArray *Img_AudioUrl;
@property (nonatomic, strong) NSMutableArray *Img_AudioImgUrl;
@property (nonatomic, strong) NSMutableArray *Img_VideoImgUrl;
@property (nonatomic, strong) NSMutableArray *Img_VideoUrl;
@property (nonatomic, strong) NSMutableArray *HomeWorkImgArr;

/** *************   回答   ************ */
@property (nonatomic, strong) NSMutableArray *Answer_Img_ImgUrl;
@property (nonatomic, strong) NSMutableArray *Answer_Img_AudioUrl;
@property (nonatomic, strong) NSMutableArray *Answer_Img_AudioImgUrl;
@property (nonatomic, strong) NSMutableArray *Answer_Img_VideoImgUrl;
@property (nonatomic, strong) NSMutableArray *Answer_Img_VideoUrl;
@property (nonatomic, strong) NSMutableArray *Answer_HomeWorkImgArr;

/** *************       批语   ************ */
@property (nonatomic, strong) NSMutableArray *Marign_Img_ImgUrl;
@property (nonatomic, strong) NSMutableArray *Marign_Img_AudioUrl;
@property (nonatomic, strong) NSMutableArray *Marign_Img_AudioImgUrl;
@property (nonatomic, strong) NSMutableArray *Marign_Img_VideoImgUrl;
@property (nonatomic, strong) NSMutableArray *Marign_Img_VideoUrl;
@property (nonatomic, strong) NSMutableArray *Marign_HomeWorkImgArr;

@end
@implementation HNMyHomeWorkMarignVC

#pragma mark - 生命周期
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    

    _Name.text = [NSString stringWithFormat:@"%@",self.nameStr];
    
    _NavigationViewHeight.constant += KIsiPhoneX ? 0:20;
    
    
    if (self.IsNotMarign) {
        
        [Marign_All1ViewArr enumerateObjectsUsingBlock:^(UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            obj.hidden = YES;
        }];
    }
    
    [self RefreshDataXXX];
}




#pragma mark - 网络
/** 获取数据 */
- (void)RefreshDataXXX {
    

    NSString *url;
    if (self.IsNotMarign) {
      
        
        url = [NSString stringWithFormat:@"assignHomework.do?action=getTopicAndAnswer&answerId=%@",[self.answerId stringValue]];
        
    }else{
        
        url = [NSString stringWithFormat:@"assignHomework.do?action=getPostil&answerId=%@",[self.answerId stringValue]];
    }
    
    
  
    
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    
    
    
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        
        
                if ([Obj[@"code"] isEqualToNumber:@1000]) {
        
                    
//                    BOOL isUp = [NSString isBlankString:Obj[@"t"][@"petname"]];
//
//                    if (isUp) {
//                        _Name.text = @"";
//                    }else{
//                         _Name.text = [NSString stringWithFormat:@"%@",Obj[@"t"][@"petname"]];
//                    }
                    
                    
                    
                  
                    [self QuestionUI:Obj[@"t"][@"arrangeHomeWorks"]];
                    
                    [self AnswerUI:Obj[@"t"][@"arrangeHomeWorkAnswer"]];
                    self.IsNotMarign == YES ? nil : [self MarignUI:Obj[@"t"][@"arrangeHomeworkPostils"]];
                    [_HidenView removeFromSuperview];
                } else {
                    [_Activity stopAnimating];
                    [MBProgressHUD showError:Obj[@"msg"]];
                }
        
        
    } Fail:^(NSError *Error) {
        
    }];
    
    
}



#pragma mark - 题目
/** 题目UI */
- (void)QuestionUI:(NSDictionary *)Dict {
    
    
    
    
    _Title.text = [NSString stringWithFormat:@"%@", Dict[@"title"]];
    
    
    
    
    BOOL isUp = [NSString isBlankString:Dict[@"content"]];
    
    if (isUp) {
        _Content.text = @" ";
        
    }else{
        _Content.text = [NSString stringWithFormat:@"%@", Dict[@"content"]];
        
    }
    
    
    
    
    // 先判断是不是null
    [Dict[@"paths"] isKindOfClass:[NSNull class]] ? nil : [Dict[@"paths"] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        NSString *Str = [obj pathExtension];
        if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
            [self.Img_ImgUrl addObject:obj];
        } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
            [self.Img_AudioImgUrl addObject:@"btn_mp3"];
            [self.Img_AudioUrl addObject:obj];
        }
    }];
    
    if (![Dict[@"videoImg"] isKindOfClass:[NSNull class]] && [Dict[@"videoImg"] length] > 0) {
        
        self.Img_VideoImgUrl = [[Dict[@"videoImg"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    if (![Dict[@"video"] isKindOfClass:[NSNull class]] && [Dict[@"video"] length] > 0) {
        
        self.Img_VideoUrl = [[Dict[@"video"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    
    
    __block NSInteger Index = 0;
    [self.Img_ImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = ImgViewArr[idx];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal) placeholderImage:[UIImage imageNamed:@"icon_add_picture"]];
        [self.HomeWorkImgArr addObject:@{obj:ImageView}];
        Index += 1;
    }];
    
    [self.Img_AudioImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = ImgViewArr[Index];
        [ImageView setBackgroundImage:[UIImage imageNamed:obj] forState:(UIControlStateNormal)];
        [self.HomeWorkImgArr addObject:@{self.Img_AudioUrl[idx]:ImageView}];
        Index += 1;
        
    }];
    
    [self.Img_VideoImgUrl enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *ImageView = ImgViewArr[Index];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal) placeholderImage:[UIImage imageNamed:@"icon_add_picture"]];
        [self.HomeWorkImgArr addObject:@{self.Img_VideoUrl[idx]:ImageView}];
        Index += 1;
    }];
}

- (IBAction)ClickHomeWorkImg:(UIButton *)Tap {
    
    [self.HomeWorkImgArr enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *Button = obj.allValues[0];
        if (Button.tag == Tap.tag ) {
            
            NSString *Str = obj.allKeys[0];
            Str = [Str pathExtension];
            if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
                [ImgZoom MgrButtonImgView:Tap];
            } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
                [self PlayerWithUrlStr:obj.allKeys[0]];
            } else {
                
                NSString *Url = obj.allKeys[0];
                self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
                
                self.webView.delegate = self;
                
                [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:Url]]];
                
                [self.view addSubview:self.webView];
                
                
                
                
            }
            
            *stop = YES;
        }
    }];
}


- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
    self.webView = nil;
}


#pragma mark - 音频播放
/** 音频播放 */
- (void)PlayerWithUrlStr:(NSString *)UrlStr
{
    if ([EMCDDeviceManager sharedInstance].isPlaying) {
        [[EMCDDeviceManager sharedInstance] stopPlaying];
    } else {
        [self RefreshDataForAmr:UrlStr Complete:^(NSString *FullPath) {
            
            FullPath = [FullPath substringFromIndex:7];
            [[EMCDDeviceManager sharedInstance] asyncPlayingWithPath:FullPath completion:^(NSError *error) {
                NSLog(@"播放完成");
            }];
        }];
    }
}

/**
 获取amr文件
 */
- (void)RefreshDataForAmr:(NSString *)UrlStr Complete:(void(^)(NSString *FullPath))Complete
{
    NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:@"AMR"];
    

    
    [NetManager DownLoadFileWithUrlStr:UrlStr FileName:[UrlStr lastPathComponent] Path:path Progress:^(CGFloat Index) {
        
        
    } Complete:^(NSString *FullPath, NSError *Err) {
        
        [MBProgressHUD hideHUD];
        if (Err)
        {
            [MBProgressHUD showError:@"音频文件播放失败"];
        }
        else
        {
            Complete (FullPath);
        }
    }];
}

- (NSMutableArray *)Img_ImgUrl{
    
    if (_Img_ImgUrl == nil) {
        self.Img_ImgUrl = [NSMutableArray array];
    }
    
    return _Img_ImgUrl;
    
}
- (NSMutableArray *)Img_AudioUrl {
    
    if (!_Img_AudioUrl) {
        
        _Img_AudioUrl = [NSMutableArray array];
    }
    return _Img_AudioUrl;
}

- (NSMutableArray *)Img_VideoUrl {
    
    if (!_Img_VideoUrl) {
        
        _Img_VideoUrl = [NSMutableArray array];
    }
    return _Img_VideoUrl;
}

- (NSMutableArray *)Img_VideoImgUrl {
    
    if (!_Img_VideoImgUrl) {
        
        _Img_VideoImgUrl = [NSMutableArray array];
    }
    return _Img_VideoImgUrl;
}

- (NSMutableArray *)HomeWorkImgArr {
    
    if (!_HomeWorkImgArr) {
        
        _HomeWorkImgArr = [NSMutableArray array];
    }
    return _HomeWorkImgArr;
}

- (NSMutableArray *)Img_AudioImgUrl {
    
    if (!_Img_AudioImgUrl) {
        
        _Img_AudioImgUrl = [NSMutableArray array];
    }
    return _Img_AudioImgUrl;
}


#pragma mark - 回答
/** 题目UI */
- (void)AnswerUI:(NSDictionary *)Dict {
    
    if (self.IsNotMarign == YES) {
        
        _CCCCCCCTitle.hidden= YES;
        _CCCCCCCContent.hidden = YES;
        _Answer_Title.hidden = YES;
        _Answer_Content.hidden = YES;
        return;
    }
    
    
    _Answer_Title.text = [NSString stringWithFormat:@"%@", _Title.text];
    
    
    BOOL isUp = [NSString isBlankString:Dict[@"answerContent"]];
    
    if (isUp) {
        _Answer_Content.text = @" ";
        
    }else{
        _Answer_Content.text = [NSString stringWithFormat:@"%@", Dict[@"answerContent"]];
        
    }
    
    
    
    
    
    // 先判断是不是null
    [Dict[@"paths"] isKindOfClass:[NSNull class]] ? nil : [Dict[@"paths"] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        NSString *Str = [obj pathExtension];
        if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
            [self.Answer_Img_ImgUrl addObject:obj];
        } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
            [self.Answer_Img_AudioImgUrl addObject:@"btn_mp3"];
            [self.Answer_Img_AudioUrl addObject:obj];
        }
    }];
    
    if (![Dict[@"answerImg"] isKindOfClass:[NSNull class]]  && [Dict[@"answerImg"] length] > 0) {
        
        self.Answer_Img_VideoImgUrl = [[Dict[@"answerImg"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    if (![Dict[@"answerVideo"] isKindOfClass:[NSNull class]] && [Dict[@"answerVideo"] length] > 0) {
        
        self.Answer_Img_VideoUrl = [[Dict[@"answerVideo"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    
    
    __block NSInteger Index = 0;
    [self.Answer_Img_ImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = Answer_ImgViewArr[idx];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal)];
        [self.Answer_HomeWorkImgArr addObject:@{obj:ImageView}];
        Index += 1;
    }];
    
    [self.Answer_Img_AudioImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = Answer_ImgViewArr[Index];
        [ImageView setBackgroundImage:[UIImage imageNamed:obj] forState:(UIControlStateNormal)];
        [self.Answer_HomeWorkImgArr addObject:@{self.Answer_Img_AudioUrl[idx]:ImageView}];
        Index += 1;
        
    }];
    
    [self.Answer_Img_VideoImgUrl enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *ImageView = Answer_ImgViewArr[Index];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal)];
        [self.Answer_HomeWorkImgArr addObject:@{self.Answer_Img_VideoUrl[idx]:ImageView}];
        Index += 1;
    }];
}

- (IBAction)AnswerClickHomeWorkImg:(UIButton *)Tap {
    
    [self.Answer_HomeWorkImgArr enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *Button = obj.allValues[0];
        if (Button.tag == Tap.tag ) {
            
            NSString *Str = obj.allKeys[0];
            Str = [Str pathExtension];
            if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
                [ImgZoom MgrButtonImgView:Tap];
            } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
                [self PlayerWithUrlStr:obj.allKeys[0]];
            } else {
                
                NSString *Url = obj.allKeys[0];
                self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
                
                self.webView.delegate = self;
                
                [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:Url]]];
                
                [self.view addSubview:self.webView];
                
                
                
                
            }
            
            *stop = YES;
        }
    }];
}

- (NSMutableArray *)Answer_Img_ImgUrl {
    
    if (!_Answer_Img_ImgUrl) {
        
        _Answer_Img_ImgUrl = [NSMutableArray array];
    }
    return _Answer_Img_ImgUrl;
}

- (NSMutableArray *)Answer_Img_AudioUrl {
    
    if (!_Answer_Img_AudioUrl) {
        
        _Answer_Img_AudioUrl = [NSMutableArray array];
    }
    return _Answer_Img_AudioUrl;
}

- (NSMutableArray *)Answer_Img_VideoUrl {
    
    if (!_Answer_Img_VideoUrl) {
        
        _Answer_Img_VideoUrl = [NSMutableArray array];
    }
    return _Answer_Img_VideoUrl;
}

- (NSMutableArray *)Answer_Img_VideoImgUrl {
    
    if (!_Answer_Img_VideoImgUrl) {
        
        _Answer_Img_VideoImgUrl = [NSMutableArray array];
    }
    return _Answer_Img_VideoImgUrl;
}

- (NSMutableArray *)Answer_HomeWorkImgArr {
    
    if (!_Answer_HomeWorkImgArr) {
        
        _Answer_HomeWorkImgArr = [NSMutableArray array];
    }
    return _Answer_HomeWorkImgArr;
}

- (NSMutableArray *)Answer_Img_AudioImgUrl {
    
    if (!_Answer_Img_AudioImgUrl) {
        
        _Answer_Img_AudioImgUrl = [NSMutableArray array];
    }
    return _Answer_Img_AudioImgUrl;
}


#pragma mark - 批语
/** 批语UI */
- (void)MarignUI:(NSDictionary *)Dict {
    
    BOOL isUp = [NSString isBlankString: Dict[@"content"]];
    
    if (isUp) {
        _Marign_Content.text = @" ";
    }else{
        _Marign_Content.text = [NSString stringWithFormat:@"%@", Dict[@"content"]];
    }
    
    
    
    
    _Marign_Socre.text = [NSString stringWithFormat:@"%@", Dict[@"score"]];
    
    // 先判断是不是null
    [Dict[@"pictures"] isKindOfClass:[NSNull class]] ? nil : [Dict[@"pictures"] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        NSString *Str = [obj pathExtension];
        if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
            [self.Marign_Img_ImgUrl addObject:obj];
        } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
            [self.Marign_Img_AudioImgUrl addObject:@"btn_mp3"];
            [self.Marign_Img_AudioUrl addObject:obj];
        }
    }];
    
    if (![Dict[@"videoImg"] isKindOfClass:[NSNull class]] && [Dict[@"videoImg"] length] > 0 ) {
        
        self.Marign_Img_VideoImgUrl = [[Dict[@"videoImg"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    if (![Dict[@"video"] isKindOfClass:[NSNull class]] && [Dict[@"video"] length] > 0) {
        
        self.Marign_Img_VideoUrl = [[Dict[@"video"] componentsSeparatedByString:@","] mutableCopy];
    }
    
    
    
    __block NSInteger Index = 0;
    [self.Marign_Img_ImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = Marign_ImgViewArr[idx];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal)];
        [self.Marign_HomeWorkImgArr addObject:@{obj:ImageView}];
        Index += 1;
    }];
    
    [self.Marign_Img_AudioImgUrl enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *ImageView = Marign_ImgViewArr[Index];
        [ImageView setBackgroundImage:[UIImage imageNamed:obj] forState:(UIControlStateNormal)];
        [self.Marign_HomeWorkImgArr addObject:@{self.Marign_Img_AudioUrl[idx]:ImageView}];
        Index += 1;
        
    }];
    
    [self.Marign_Img_VideoImgUrl enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *ImageView = Marign_ImgViewArr[Index];
        [ImageView sd_setBackgroundImageWithURL:[NSURL URLWithString:obj] forState:(UIControlStateNormal)];
        [self.Marign_HomeWorkImgArr addObject:@{self.Marign_Img_VideoUrl[idx]:ImageView}];
        Index += 1;
    }];
}



- (IBAction)MarignClickHomeWorkImg:(UIButton *)Tap {
    
    [self.Marign_HomeWorkImgArr enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        UIButton *Button = obj.allValues[0];
        if (Button.tag == Tap.tag ) {
            
            NSString *Str = obj.allKeys[0];
            Str = [Str pathExtension];
            if ([Str isEqualToString:@"png"] || [Str isEqualToString:@"jpg"]) {
                [ImgZoom MgrButtonImgView:Tap];
            } else if ([Str isEqualToString:@"amr"] || [Str isEqualToString:@"mp3"]) {
                [self PlayerWithUrlStr:obj.allKeys[0]];
            } else {
                
                NSString *Url = obj.allKeys[0];
                self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
                
                self.webView.delegate = self;
                
                [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:Url]]];
                
                [self.view addSubview:self.webView];
                
                
                
                
            }
            
            *stop = YES;
        }
    }];
}

- (NSMutableArray *)Marign_Img_ImgUrl {
    
    if (!_Marign_Img_ImgUrl) {
        
        _Marign_Img_ImgUrl = [NSMutableArray array];
    }
    return _Marign_Img_ImgUrl;
}

- (NSMutableArray *)Marign_Img_AudioUrl {
    
    if (!_Marign_Img_AudioUrl) {
        
        _Marign_Img_AudioUrl = [NSMutableArray array];
    }
    return _Marign_Img_AudioUrl;
}

- (NSMutableArray *)Marign_Img_VideoUrl {
    
    if (!_Marign_Img_VideoUrl) {
        
        _Marign_Img_VideoUrl = [NSMutableArray array];
    }
    return _Marign_Img_VideoUrl;
}

- (NSMutableArray *)Marign_Img_VideoImgUrl {
    
    if (!_Marign_Img_VideoImgUrl) {
        
        _Marign_Img_VideoImgUrl = [NSMutableArray array];
    }
    return _Marign_Img_VideoImgUrl;
}

- (NSMutableArray *)Marign_HomeWorkImgArr {
    
    if (!_Marign_HomeWorkImgArr) {
        
        _Marign_HomeWorkImgArr = [NSMutableArray array];
    }
    return _Marign_HomeWorkImgArr;
}

- (NSMutableArray *)Marign_Img_AudioImgUrl {
    
    if (!_Marign_Img_AudioImgUrl) {
        
        _Marign_Img_AudioImgUrl = [NSMutableArray array];
    }
    return _Marign_Img_AudioImgUrl;
}
#pragma mark - 事件
- (IBAction)Pop {
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)viewDidLayoutSubviews {
    
    [super viewDidLayoutSubviews];
    
    if (self.IsNotMarign == YES) {
    _ScrollVIewHeight.constant = _XXXXView.frame.size.height + _XXXXView.frame.origin.y;
    } else {
    _ScrollVIewHeight.constant = _MarignWhiteView.frame.size.height + _MarignWhiteView.frame.origin.y;
    }
    
}
@end
